body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f0f0f0;
    color: #333;
}

h1 {
    margin-top: 20px;
}

.controls {
    display: flex;
    flex-direction: column;
    width: 610px;
    margin: 15px 0;
    padding: 10px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    gap: 10px;
}

.controls > div {
    width: 100%;
}

.player-selection, .ai-level-selection {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.player-selection span, .ai-level-selection span {
    width: 100%;
    margin-bottom: 3px;
}

.game-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.ai-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background-color: #e8f5e9;
    border-radius: 4px;
    min-height: 40px;
}

.ai-visualization {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.ai-visualization label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 14px;
}

.ai-visualization input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.ai-controls button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f8f8f8;
    cursor: pointer;
    font-size: 14px;
}

.ai-controls button:hover:not(:disabled) {
    background-color: #e8e8e8;
}

.ai-controls button:disabled {
    background-color: #ddd;
    color: #999;
    cursor: not-allowed;
}

#ai-status {
    font-weight: bold;
    color: #2e7d32;
    margin-left: 10px;
}

.player-selection button, .game-actions button, .file-upload-label, .ai-level-selection button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f8f8f8;
    cursor: pointer;
    font-size: 14px;
}

.player-selection button:hover, .game-actions button:hover, .file-upload-label:hover, .ai-level-selection button:hover {
    background-color: #e8e8e8;
}

.game-actions button:disabled {
    background-color: #ddd;
    color: #999;
    cursor: not-allowed;
    border-color: #ccc;
}

.game-actions button:disabled:hover {
    background-color: #ddd;
}

.player-selection .selected, .ai-level-selection .selected {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

#board-container {
    padding: 15px;
    background-color: #dcb35c;
    border: 2px solid black;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    display: inline-block;
}

#board-wrapper {
    position: relative;
    display: inline-block;
}

#board {
    display: grid;
    grid-template-columns: repeat(19, 30px);
    grid-template-rows: repeat(19, 30px);
    width: 570px; /* 19 * 30 */
    height: 570px; /* 19 * 30 */
    position: relative;
    margin-left: 20px;
    margin-top: 20px;
    background-color: #dcb35c;
    background-image:
        repeating-linear-gradient(90deg, transparent 0, transparent 14.5px, #000 14.5px, #000 15.5px, transparent 15.5px, transparent 30px),
        repeating-linear-gradient(0deg, transparent 0, transparent 14.5px, #000 14.5px, #000 15.5px, transparent 15.5px, transparent 30px);
}

#board::before {
    display: none;
}

.labels {
    position: absolute;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    pointer-events: none;
}

.col-labels {
    top: 0;
    left: 20px;
    width: 570px;
    height: 20px;
    display: block;
    position: absolute;
}

.col-labels span {
    position: absolute;
    text-align: center;
    transform: translateX(-50%);
}

.row-labels {
    left: 0;
    top: 20px;
    width: 20px;
    height: 570px;
    display: block;
    position: absolute;
}

.row-labels span {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    transform: translateY(-50%);
}

.territory-info {
    width: 572px;
    margin-top: 15px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-around;
}

.territory-item {
    display: flex;
    align-items: center;
}

.territory-label {
    font-size: 16px;
    font-weight: bold;
    margin-right: 10px;
}

.territory-value {
    font-size: 20px;
    font-weight: bold;
    color: #4CAF50;
}

.territory-value.neutral {
    color: #999;
}

.capture-info {
    width: 610px;
    margin-top: 15px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-around;
}

.capture-item {
    display: flex;
    align-items: center;
}

.capture-label {
    font-size: 16px;
    font-weight: bold;
    margin-right: 10px;
}

.capture-value {
    font-size: 20px;
    font-weight: bold;
    color: #f44336;
}

.intersection {
    width: 30px;
    height: 30px;
    position: relative;
    cursor: pointer;
}

.stone {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    position: absolute;
    top: 15px;
    left: 15px;
    transform: translate(-50%, -50%);
    box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-sizing: border-box;
}

.black {
    background: radial-gradient(circle at 8px 8px, #555, #000);
}

.white {
    background: radial-gradient(circle at 8px 8px, #fff, #ccc);
}

.stone-preview {
    opacity: 0.5;
}

.replay-controls {
    margin-top: 20px;
    display: flex;
    align-items: center;
}

.replay-controls button {
    width: 40px;
    height: 30px;
    margin: 0 5px;
}

#move-counter {
    font-size: 16px;
    margin: 0 10px;
    min-width: 60px;
    text-align: center;
}
/* AI Heatmap Visualization */
.heatmap-overlay {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(0,0,0,0.8);
}

/* AI Suggestion Marker */
.suggestion-marker {
    position: absolute;
    top: 15px;
    left: 15px;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid #FFD700;
    border-radius: 50%;
    pointer-events: none;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.8);
}

.suggestion-marker.rank-1 {
    border-color: #FFD700;
    width: 24px;
    height: 24px;
    border-width: 4px;
}

.suggestion-marker.rank-2 {
    border-color: #FFA500;
    width: 22px;
    height: 22px;
}

.suggestion-marker.rank-3 {
    border-color: #FF8C00;
    width: 20px;
    height: 20px;
}

.suggestion-marker.rank-4 {
    border-color: #FF7F50;
    width: 18px;
    height: 18px;
}

.suggestion-marker.rank-5 {
    border-color: #FF6347;
    width: 16px;
    height: 16px;
}

/* Number label for suggestions */
.suggestion-number {
    position: absolute;
    top: 15px;
    left: 15px;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    pointer-events: none;
    z-index: 10;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1.1);
    }
}
